<template>
  <div>
    <div>
      <el-form
        :label-position="left"
        label-width="100px"
        :model="formLabelAlign"
        size="mini"
      >
        <el-row>
          <el-col :span="8">
            <el-form-item label="工单大类">
              <el-select
                style="width: 100%"
                v-model="formLabelAlign.bigType"
                placeholder="请选择大类"
                @change="updateLevel2Options"
              >
                <el-option
                  v-for="item in level1Options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工单中类">
              <el-select
                style="width: 100%"
                v-model="formLabelAlign.workTaskType"
                placeholder="请选择中类"
                @change="updateLevel3Options"
              >
                <el-option
                  v-for="item in level2Options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工单小类">
              <el-select
                style="width: 100%"
                v-model="formLabelAlign.threeType"
                placeholder="请选择小类"
              >
                <el-option
                  v-for="item in level3Options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工单编号" width="100%">
              <el-input v-model="formLabelAlign.workTaskNo"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开始日期">
              <el-date-picker
                style="width: 100%"
                v-model="formLabelAlign.startTime"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="结束日期">
              <el-date-picker
                style="width: 100%"
                v-model="formLabelAlign.endTime"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户姓名" width="100%">
              <el-input v-model="formLabelAlign.customerName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户电话">
              <el-input v-model="formLabelAlign.customerPhone"></el-input>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-form-item label="营销中心">
              <el-select style="width: 100%" v-model="formLabelAlign.myd">
                <el-option label="非常满意" value="5"></el-option>
                <el-option label="满意" value="4"></el-option>
                <el-option label="一般" value="3"></el-option>
                <el-option label="不满意" value="2"></el-option>
                <el-option label="未评价" value="1"></el-option>
              </el-select>
            </el-form-item>
          </el-col> -->

          <el-col :span="8">
            <el-form-item label="证件号">
              <el-input v-model="formLabelAlign.customerIdCard"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="借据号">
              <el-input v-model="formLabelAlign.loanNo"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row
          style="
            display: flex;
            justify-content: end;
            text-align: center;
            margin-top: 10px;
          "
        >
          <el-col :span="2">
            <el-button
              type="primary"
              @click="perSearch(formLabelAlign)"
              size="mini"
              >查询</el-button
            >
          </el-col>

          <el-col :span="2">
            <el-button type="primary" @click="resetall()" size="mini"
              >重置</el-button
            >
          </el-col>

          <el-col :span="2">
            <!-- <el-form-item> -->
            <el-button type="primary" @click="perReset()" size="mini"
              >查看工单
            </el-button>
            <!-- </el-form-item> -->
          </el-col>
        </el-row>
      </el-form>

      <div style="margin-top: 2rem">
        <el-table
          :data="tableData.list"
          tooltip-effect="dark"
          @current-change="clickRow"
          highlight-current-row
          style="width: 100%; font-size: 13px"
          :header-cell-style="{ textAlign: 'center' }"
          :cell-style="{ textAlign: 'center' }"
          :row-style="tableRowClassName"
        >
          <el-table-column
            :prop="item.prop"
            :label="item.label"
            v-for="(item, index) in tableData.option"
            :key="index"
            :width="item.width"
          >
            <template slot-scope="scope">
              <span v-if="item.prop === 'status'">
                <span v-if="scope.row[item.prop] === '1'">待提交</span>
                <span v-else-if="scope.row[item.prop] === '2'">待审核</span>
                <span v-else-if="scope.row[item.prop] === '3'">审核中</span>
                <span v-else-if="scope.row[item.prop] === '4'">待处理</span>
                <span v-else-if="scope.row[item.prop] === '5'">处理中</span>
                <span v-else-if="scope.row[item.prop] === '6'">待回复</span>
                <span v-else-if="scope.row[item.prop] === '7'">回复中</span>
                <span v-else-if="scope.row[item.prop] === '8'">待评审</span>
                <span v-else-if="scope.row[item.prop] === '9'">评审中</span>
                <span v-else-if="scope.row[item.prop] === '10'">待归档</span>
                <span v-else-if="scope.row[item.prop] === '11'"
                  >归档处理中</span
                >
                <span v-else-if="scope.row[item.prop] === '12'">已归档</span>
                <span v-else-if="scope.row[item.prop] === '13'">无效</span>
                <span v-else> {{ scope.row[item.prop] }}</span>
              </span>
              <!-- 其他列 -->
              <span v-else>{{ scope.row[item.prop] }}</span>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页 -->
        <el-row
          type="flex"
          justify="end"
          align="middle"
          style="height: 60px"
          v-if="tableData.paging"
        >
          <el-pagination
            background
            @current-change="handleCurrentChange"
            :current-page.sync="tableData.page.page"
            :page-size="tableData.page.size"
            layout="total, prev, pager, next"
            :total="tableData.page.total"
            :small="true"
          >
          </el-pagination>
        </el-row>
      </div>
    </div>

    <div>
      <!-- 查看工单详情 -->
      <el-dialog :visible.sync="dialogTableVisible" width="80%">
        <template slot="title">
          <span style="text-align: center; display: block; color: #fff"
            >工单信息</span
          >
        </template>
        <div v-if="showorderlist">
          <el-form
            :label-position="left"
            label-width="130px"
            :model="showorderlist"
            size="mini"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="类型:">
                  {{ showorderlist.bigType || "" }}
                  /
                  {{ showorderlist.workTaskType || "" }}
                  /
                  {{ showorderlist.threeType || "" }}

                  <!-- {{ showorderlist.bigType }}
                  /
                  {{ showorderlist.workTaskType }}
                  /
                  {{ showorderlist.threeType }} -->
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工单状态:">
                  <span v-if="showorderlist.status === '1'">待提交</span>
                  <span v-else-if="showorderlist.status === '2'">待审核</span>
                  <span v-else-if="showorderlist.status === '3'">审核中</span>
                  <span v-else-if="showorderlist.status === '4'">待处理</span>
                  <span v-else-if="showorderlist.status === '5'">处理中</span>
                  <span v-else-if="showorderlist.status === '6'">待回复</span>
                  <span v-else-if="showorderlist.status === '7'">回复中</span>
                  <span v-else-if="showorderlist.status === '8'">待评审</span>
                  <span v-else-if="showorderlist.status === '9'">评审中</span>
                  <span v-else-if="showorderlist.status === '10'">待归档</span>
                  <span v-else-if="showorderlist.status === '11'"
                    >归档处理中</span
                  >
                  <span v-else-if="showorderlist.status === '12'">已归档</span>
                  <span v-else-if="showorderlist.status === '13'">无效</span>

                  <span v-else> {{ showorderlist.status }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工单编号:">
                  {{ showorderlist.workTaskNo }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="登记日期:">
                  {{ showorderlist.createDate }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="填单人:">
                  {{ showorderlist.createrEmpName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属部门:">
                  {{ showorderlist.belongDeptName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工单审核人员:">
                  {{ showorderlist.appointerEmpName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工单处理部门:">
                  {{ showorderlist.operatorOrgName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="是否加急:">
                  {{ showorderlist.unGent == 1 ? "是" : "否" }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="流转人员处理时限:"> </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工单目标完成时限:"> </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户姓名:">
                  {{ showorderlist.customerName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="证件类型:">
                  <span v-if="showorderlist.customerIdCardType == '20'"
                    >身份证</span
                  >
                  <span v-else> {{ showorderlist.customerIdCardType }} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="证件号:">
                  {{ showorderlist.customerIdCard }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="申请流水号:"> </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户电话:">
                  {{ showorderlist.customerPhone }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="回访电话:">
                  {{ showorderlist.customerRephone }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="E-mail:">
                  {{ showorderlist.customerEmail }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="营消潜在客户:"> </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="借据号:">
                  {{ showorderlist.loanNo }}
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="具体事项:">
                  {{ showorderlist.remark }}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>

        <div>
          <span style="text-align: center; display: block; color: #000"
            >工单历史记录</span
          >
          <el-table
            :data="gridData.list"
            :header-cell-style="{ textAlign: 'center' }"
            :cell-style="{ textAlign: 'center' }"
          >
            <el-table-column
              :prop="item.prop"
              :label="item.label"
              v-for="(item, index) in gridData.option"
              :key="index"
              :header-cell-style="{ textAlign: 'center', color: '#000' }"
            >
              <template slot-scope="scope">
                <span v-if="item.prop === 'worktaskStatus'">
                  <span v-if="scope.row[item.prop] === '1'">待提交</span>
                  <span v-else-if="scope.row[item.prop] === '2'">待审核</span>
                  <span v-else-if="scope.row[item.prop] === '3'">审核中</span>
                  <span v-else-if="scope.row[item.prop] === '4'">待处理</span>
                  <span v-else-if="scope.row[item.prop] === '5'">处理中</span>
                  <span v-else-if="scope.row[item.prop] === '6'">待回复</span>
                  <span v-else-if="scope.row[item.prop] === '7'">回复中</span>
                  <span v-else-if="scope.row[item.prop] === '8'">待评审</span>
                  <span v-else-if="scope.row[item.prop] === '9'">评审中</span>
                  <span v-else-if="scope.row[item.prop] === '10'">待归档</span>
                  <span v-else-if="scope.row[item.prop] === '11'"
                    >归档处理中</span
                  >
                  <span v-else-if="scope.row[item.prop] === '12'">已归档</span>
                  <span v-else-if="scope.row[item.prop] === '13'">无效</span>

                  <span v-else> {{ scope.row[item.prop] }}</span>
                </span>
                <span v-else>{{ scope.row[item.prop] }}</span>
              </template>
            </el-table-column>

            <!-- <el-table-column
              property="date"
              label="工单状态:"
              width="150"
            ></el-table-column>
            <el-table-column
              property="name"
              label="记录日期:"
            ></el-table-column>
            <el-table-column
              property="appointerName"
              label="操作人:"
            ></el-table-column>
            <el-table-column
              property="transferDeptName"
              label="转至部门:"
            ></el-table-column>
            <el-table-column
              property="toAppointerName"
              label="部门处理人员:"
            ></el-table-column>
            <el-table-column
              property="remark"
              label="备注:"
              width="300"
            ></el-table-column> -->
          </el-table>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  queryWorkorder,
  queryWorkorderHistory,
} from "@/api/hubeixiaojin/queryInfo";

export default {
  name: "workorder",
  props: ["data"],
  data() {
    return {
      gridData: {
        list: [],
        option: [
          {
            label: "工单状态",
            prop: "worktaskStatus",
          },
          {
            label: "记录日期",
            prop: "createTime",
          },
          {
            label: "操作人",
            prop: "appointerName",
          },
          {
            label: "转至部门",
            prop: "transferDeptName",
          },
          {
            label: "部门处理人员",
            prop: "toAppointerName",
          },
          {
            label: "备注",
            prop: "appointContent",
          },
        ],
      },
      dialogTableVisible: false,
      formLabelAlign: {
        bigType: "", // 工单大类
        workTaskType: "", // 工单中类
        threeType: "", // 工单小类
        workTaskNo: "", // 工单编号
        startTime: "", // 开始时间
        endTime: "", // 结束时间
        customerName: "", // 客户姓名
        customerPhone: "", // 客户号码
        customerIdCard: "", // 客户证件号
        loanNo: "", // 借据号
      },
      level1Options: [
        { value: "AA", label: "营销团队沟通" },
        { value: "AD", label: "投诉转办单" },
        { value: "AE", label: "业务质检" },
        { value: "AF", label: "主管协助处理" },
        { value: "AG", label: "催收团队" },
        { value: "AI", label: "结清证明开具" },
        { value: "AJ", label: "QA协助跟进" },
        { value: "AK", label: "电催相关" },
        { value: "AL", label: "征信预警" },
        { value: "AM", label: "二次营销" },
        { value: "AN", label: "档案和抵押品" },
      ],
      level2Options: [],
      level3Options: [],
      tableData: {
        list: [],
        option: [
          {
            label: "任务流水号",
            prop: "workTaskNo",
            width: 150,
          },
          {
            label: "客户姓名",
            prop: "customerName",
          },
          {
            label: "工单大类",
            prop: "bigType",
          },
          {
            label: "工单中类",
            prop: "workTaskType",
          },
          {
            label: "工单小类",
            prop: "threeTypeName",
          },
          {
            label: "提交人工号",
            prop: "createrEmpId",
          },
          {
            label: "处理人工号",
            prop: "appointEmpId",
          },
          {
            label: "处理日期",
            prop: "currentDealLineDate",
          },
          {
            label: "状态",
            prop: "status",
          },
        ],
        page: {
          page: 1,
          size: 10,
          total: 0,
        },
        paging: true,
      },
      agentInfo: {}, //调单用到的座席信息
      showorderlist: {
        bigType: "",
        workTaskType: "",
        threeType: "",
        workTaskNo: "",
        customerName: "",
        customerIdCard: "",
        customerPhone: "",
        customerEmail: "",
        loanNo: "",
      },
    };
  },
  mounted() {
    const sessionStr = sessionStorage.getItem("userInfo");
    const agentUser = JSON.parse(sessionStr);
    this.agentInfo = agentUser.content;
    // this.getinfo();
  },
  created() {},
  methods: {
    //录音调听
    getinfo() {
      console.log("输入框汇总", this.formLabelAlign);
      var params = {
        sortCol: "id",
        condition: {
          ...this.formLabelAlign,
        }, //申请状态
        page: this.tableData.page.page,
        pageSize: this.tableData.page.size,
      };
      queryWorkorder(params, this.agentInfo)
        .then((res) => {
          console.log("接口返回==", res.data.data);
          var data = res.data.data.listData;

          data.forEach((element) => {
            if (element.bigType === "AA") {
              element.bigType = "营销团队沟通";
              if (element.workTaskType === "aa") {
                element.workTaskType = "营销团队协助出处理";
              }
            } else if (element.bigType === "AD") {
              element.bigType = "投诉转办单";
              if (element.workTaskType === "ac") {
                element.workTaskType = "产品及营销类";
              } else if (element.workTaskType === "ah") {
                element.workTaskType = "风险类";
              } else if (element.workTaskType === "ab") {
                element.workTaskType = "服务类";
              } else if (element.workTaskType === "ag") {
                element.workTaskType = "其他类";
              } else if (element.workTaskType === "ai") {
                element.workTaskType = "渠道类";
              }
            } else if (element.bigType === "AE") {
              element.bigType = "业务质检";
              if (element.workTaskType === "ab") {
                element.workTaskType = "电催质检明细";
              } else if (element.workTaskType === "ad") {
                element.workTaskType = "电核质检明细";
              } else if (element.workTaskType === "ac") {
                element.workTaskType = "电销质检明细";
              } else if (element.workTaskType === "ae") {
                element.workTaskType = "工单质检明细";
              } else if (element.workTaskType === "---") {
                element.workTaskType = "客服质检明细";
              }
            } else if (element.bigType === "AF") {
              element.bigType = "主管协助处理";
              if (element.workTaskType === "ab") {
                element.workTaskType = "投诉升级";
              } else if (element.workTaskType === "ad") {
                element.workTaskType = "主动还款工单";
              } else if (element.workTaskType === "ac") {
                element.workTaskType = "主管协助处理";
              }
            } else if (element.bigType === "AG") {
              element.bigType = "催收团队";
              if (element.workTaskType === "aa") {
                element.workTaskType = "催收记录反馈";
              }
            } else if (element.bigType === "AI") {
              element.bigType = "结清证明开具";
              if (element.workTaskType === "aa") {
                element.workTaskType = "申请开具结清证明";
              }
            } else if (element.bigType === "AJ") {
              element.bigType = "QA协助跟进";
              if (element.workTaskType === "aa") {
                element.workTaskType = "QA协助处理";
              }
            } else if (element.bigType === "AK") {
              element.bigType = "电催相关";
              if (element.workTaskType === "AB") {
                element.workTaskType = "归正明细";
              } else if (element.workTaskType === "AC") {
                element.workTaskType = "还款确认";
              } else if (element.workTaskType === "AD") {
                element.workTaskType = "投诉电催";
              } else if (element.workTaskType === "AA") {
                element.workTaskType = "转属地明细";
              }
            } else if (element.bigType === "AL") {
              element.bigType = "征信预警";
              if (element.workTaskType === "AA") {
                element.workTaskType = "征信预警";
              }
            } else if (element.bigType === "AM") {
              element.bigType = "二次营销";
              if (element.workTaskType === "AA") {
                element.workTaskType = "二次营销下户名单";
              } else if (element.workTaskType === "AB") {
                element.workTaskType = "贷款需求";
              }
            } else if (element.bigType === "AN") {
              element.bigType = "档案和抵押品";
              if (element.workTaskType === "AA") {
                element.workTaskType = "档案类";
              } else if (element.workTaskType === "AB") {
                element.workTaskType = "押品类";
              }
            }
          });

          this.tableData.list = data;
          this.tableData.page.total = res.data.data.totalCount;
        })

        .catch((err) => {
          console.log(err);
        });
    },

    updateLevel2Options() {
      if (this.formLabelAlign.bigType === "AA") {
        this.level2Options = [{ value: "aa", label: "营销团队协助出处理" }];
      } else if (this.formLabelAlign.bigType === "AD") {
        this.level2Options = [
          { value: "ac", label: "产品及营销类" },
          { value: "ah", label: "风险类" },
          { value: "ab", label: "服务类" },
          { value: "ag", label: "其他类" },
          { value: "ai", label: "渠道类" },
        ];
      } else if (this.formLabelAlign.bigType === "AE") {
        this.level2Options = [
          { value: "ab", label: "电催质检明细" },
          { value: "ad", label: "电核质检明细" },
          { value: "ac", label: "电销质检明细" },
          { value: "ae", label: "工单质检明细" },
          { value: "---", label: "客服质检明细" },
        ];
      } else if (this.formLabelAlign.bigType === "AF") {
        this.level2Options = [
          { value: "ab", label: "投诉升级" },
          { value: "ad", label: "主动还款工单" },
          { value: "ac", label: "主管协助处理" },
        ];
      } else if (this.formLabelAlign.bigType === "AG") {
        this.level2Options = [{ value: "aa", label: "催收记录反馈" }];
      } else if (this.formLabelAlign.bigType === "AI") {
        this.level2Options = [{ value: "aa", label: "申请开具结清证明" }];
      } else if (this.formLabelAlign.bigType === "AJ") {
        this.level2Options = [{ value: "aa", label: "QA协助处理" }];
      } else if (this.formLabelAlign.bigType === "AK") {
        this.level2Options = [
          { value: "AB", label: "归正明细" },
          { value: "AC", label: "还款确认" },
          { value: "AD", label: "投诉电催" },
          { value: "AA", label: "转属地明细" },
        ];
      } else if (this.formLabelAlign.bigType === "AL") {
        this.level2Options = [{ value: "AA", label: "征信预警" }];
      } else if (this.formLabelAlign.bigType === "AM") {
        this.level2Options = [
          { value: "AB", label: "贷款需求" },
          { value: "AA", label: "二次营销下户名单" },
        ];
      } else if (this.formLabelAlign.bigType === "AN") {
        this.level2Options = [
          { value: "AA", label: "档案类" },
          { value: "AB", label: "押品类" },
        ];
      } else {
        this.level2Options = [];
      }
      this.formLabelAlign.workTaskType = "";
      this.updateLevel3Options();
    },
    updateLevel3Options() {
      if (this.formLabelAlign.workTaskType === "营销团队协助出处理") {
        this.level3Options = [{ value: "营销中心反馈", label: "营销中心反馈" }];
      } else if (this.formLabelAlign.workTaskType === "产品及营销类") {
        this.level3Options = [
          { value: "产品计费", label: "产品计费" },
          { value: "电话语音服务", label: "电话语音服务" },
          { value: "营销服务", label: "营销服务" },
        ];
      } else if (this.formLabelAlign.workTaskType === "风险类") {
        this.level3Options = [{ value: "催收异议", label: "代偿异议" }];
      } else if (this.formLabelAlign.workTaskType === "服务类") {
        this.level3Options = [
          { value: "电话骚扰", label: "电话骚扰" },
          { value: "短信服务异议", label: "短信服务异议" },
          { value: "客户信息安全", label: "客户信息安全" },
          { value: "扣款异议", label: "扣款异议" },
          { value: "征信异议", label: "征信异议" },
        ];
      } else if (this.formLabelAlign.workTaskType === "其他类") {
        this.level3Options = [{ value: "其他异议", label: "其他异议" }];
      } else if (this.formLabelAlign.workTaskType === "渠道类") {
        this.level3Options = [
          { value: "渠道挪用资金", label: "渠道挪用资金" },
          { value: "渠道收费", label: "渠道收费" },
        ];
      } else if (this.formLabelAlign.workTaskType === "电催质检明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "电核质检明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "电销质检明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "工单质检明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "客服质检明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "投诉升级") {
        this.level3Options = [{ value: "投诉升级", label: "投诉升级" }];
      } else if (this.formLabelAlign.workTaskType === "主动还款工单") {
        this.level3Options = [{ value: "主动还款", label: "主动还款" }];
      } else if (this.formLabelAlign.workTaskType === "主管协助处理") {
        this.level3Options = [{ value: "主管协助处理", label: "主管协助处理" }];
      } else if (this.formLabelAlign.workTaskType === "催收记录反馈") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "申请开具结清证明") {
        this.level3Options = [
          { value: "申请开具结清证明", label: "申请开具结清证明" },
        ];
      } else if (this.formLabelAlign.workTaskType === "QA协助处理") {
        this.level3Options = [
          { value: "QA协助处理—其他渠道", label: "QA协助处理—其他渠道" },
          { value: "QA协助处理—小米", label: "QA协助处理—小米" },
          { value: "QA协助处理—小鱼", label: "QA协助处理—小鱼" },
          { value: "QA协助处理—移动", label: "QA协助处理—移动" },
          { value: "QA协助处理—宇信", label: "QA协助处理—宇信" },
        ];
      } else if (this.formLabelAlign.workTaskType === "归正明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "还款确认") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "投诉电催") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "转属地明细") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "征信预警名单") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "贷款需求") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "二次营销下户名单") {
        this.level3Options = [];
      } else if (this.formLabelAlign.workTaskType === "档案类") {
        this.level3Options = [
          { value: "调阅需归还明细", label: "调阅需归还明细" },
          { value: "未移交档案明细", label: "未移交档案明细" },
        ];
      } else if (this.formLabelAlign.workTaskType === "押品类") {
        this.level3Options = [
          { value: "系统未录入明细", label: "系统未录入明细" },
        ];
      } else {
        this.level3Options = [];
      }
      this.formLabelAlign.threeType = "";
    },
    perSearch(val) {
      console.log("查询", val);

      this.tableData.page.page = 1;
      this.getinfo();
    },
    resetall() {
      //重置按钮
      this.formLabelAlign = {
        bigType: "", //工单大类
        workTaskType: "", //工单中类
        threeType: "",
        workTaskNo: "", //工单编号
        startTime: "", //开始时间
        endTime: "", //结束时间
        customerName: "", //客户姓名
        customerPhone: "", //客户号码
        //营销中心
        customerIdCard: "", //客户证件号
        loanNo: "", //借据号
      };
    },
    perReset() {
      //查看工单历史调用接口
      console.log("选中的工单", this.showorderlist);
      if (this.showorderlist == null) {
        return window.globalUiKit.notify("提示", "请选择工单", "error");
      } else if (this.showorderlist.workTaskNo == "") {
        return window.globalUiKit.notify("提示", "请选择工单", "error");
      }

      var params = {
        sortCol: "id",
        condition: {
          workTaskNo: this.showorderlist.workTaskNo,
        }, //申请状态
      };
      queryWorkorderHistory(params, this.agentInfo)
        .then((res) => {
          this.gridData.list = res.data.data.listData;
          console.log("工单历史接口返回==", res.data.data.listData);
        })

        .catch((err) => {
          console.log(err);
        });
      this.dialogTableVisible = true;
    },
    //切换当前页
    handleCurrentChange(val) {
      this.tableData.page.page = val;
      this.getinfo();
    },
    clickRow(val) {
      this.showorderlist = val;
      console.log("当前选中工单为", val);
    },
  },
};
</script>

<style scoped>
.deductionApply .el-col {
  margin-top: 10px;
  width: 32%;
}

.deductionApply .el-col-10 {
  width: 32%;
}

.deductionQuery .el-col-10 {
  width: 35%;
}
</style>
